<?php
/**
 * @version 0.8.3 2010-10-07
 * @package Joomla
 * @subpackage LeagueResults
 * @copyright (C)  2008, 2009, 2010 Henryk Drozd
 * @license GNU/GPL, see LICENSE.php
 * LeagueResults is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License 2
 * as published by the Free Software Foundation.

 * LeagueResults is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.view');
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'classes'.DS.'admin.class.php');
class lrViewLstable extends JView
{

	function display($tpl = null)
	{
	global $option;
	//$settings = lrAdmin::config();
	
	$model = &$this->getModel();
	$list = &$model->getList();

	$document 	= & JFactory::getDocument();
	$c = lrAdmin::config();$document->addStyleSheet($this->baseurl.'/components/com_lr/assets/css/'.$c->css_file);
	
	for ($i=0; $i <count($list);$i++)
		{
		$row = &$list[$i];

		$row->link = JRoute::_('index.php?option='.$option.'&id='.$row->team_id.'&season='.$row->leagueseasons_id.'&view=team');
		$row->clublink = JRoute::_('index.php?option='.$option.'&id='.$row->club_id.'&view=club');
		
		$row->formattedtdate = date($c->dateformat, strtotime($row->tdate.' 00:00:00'));
		}
	$tablemap['promoted'] = $row->promoted;
	$tablemap['semipromoted'] = $row->semipromoted+$row->promoted;
	$tablemap['semirelegated'] = $row->noofteams-$row->relegated-$row->semirelegated+1;
	$tablemap['relegated'] = $row->noofteams-$row->relegated+1;
			
	$this->assignRef('tablemap', $tablemap);
	$this->assignRef('list', $list);
	$this->assignRef('settings', lrAdmin::config());
	
	$this->backlink = JRoute::_('index.php?option='.$option.'&id='.$row->club_id.'&view=club');
	
	$lstable_tpl = JRequest::getVar('lstable_tpl');

	parent::display($tpl);
	}
}
?>
